﻿<UserControl 
    x:Class="RecentActivityView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WPFLOBMVVM"
    xmlns:Ocean_WPF="clr-namespace:Ocean.OceanFramework.WPF;assembly=OceanFrameworkWPF"
    xmlns:Ocean_MVVM="clr-namespace:Ocean.OceanFramework.MVVM;assembly=OceanFrameworkWPF">
    <DockPanel LastChildFill="True">

        <Grid DockPanel.Dock="Top" HorizontalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Ocean_WPF:CustomToolBarButton Command="{Binding Path=RequestCloseCommand}" ButtonText="Close" EnabledButtonImage="../Resources/Images/Close.png" ToolTip="Close contact form" DisabledButtonImage="../Resources/Images/CloseDisabled.png" Grid.Column="1" VerticalAlignment="Top"/>
        </Grid>

        <Border Grid.Column="0" Margin="11" BorderBrush="LightGray" BorderThickness="1" CornerRadius="10" Padding="10" >
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <TextBlock HorizontalAlignment="Center" Text="Recent WPF Disciples Blog Activity" Margin="0,7" FontFamily="Aerial" FontSize="14" FontWeight="Bold" Background="WhiteSmoke" />
                <ListView Grid.Row="1" ItemsSource="{Binding Path=RecentBlogActivity}">
                    <ListView.ItemContainerStyle>
                        <Style TargetType="ListViewItem">
                            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                        </Style>
                    </ListView.ItemContainerStyle>
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Header="Date Published">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=DatePublished, StringFormat=\{0:d\}}" />
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>

                            <GridViewColumn Header="Author" DisplayMemberBinding="{Binding Path=Author}" />
                            <GridViewColumn Header="Category" DisplayMemberBinding="{Binding Path=Category}" />

                            <GridViewColumn Header="Title">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock >
                                    <Hyperlink Command="{Binding Path=DataContext.BlogNavigateCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" CommandParameter="{Binding Path=URL}">
                                        <TextBlock Text="{Binding Path=Title}" />
                                    </Hyperlink>
                                </TextBlock>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>

                        </GridView>
                    </ListView.View>
                </ListView>

            </Grid>
        </Border>

    </DockPanel>

</UserControl>
